import React from 'react'

import store from './store'
import { Provider } from 'react-redux'

import { Globalstyle } from './style.js'

import { HashRouter, Route, Switch, Redirect } from 'react-router-dom'

import Home from './pages/home'
import Add from './pages/add'
import History from './pages/history'

// 函数组件
const App: React.FC = () => {
	return (
		<React.Fragment>
			<Provider store={store}>
				<HashRouter>
					<Switch>
						<Route path='/' exact render={() => (<Redirect to="/home"></Redirect>)}></Route>
						<Route path='/home' component={Home}></Route>
						<Route path='/add' component={Add}></Route>
						<Route path='/history' component={History}></Route>
					</Switch>
				</HashRouter>
			</Provider>
			<Globalstyle/>
		</React.Fragment>
	)
}

export default App
